package org.atlantis.grosbeak.lang.filefilter;

import java.io.File;
import java.io.FileFilter;

/**
 * @author <a href="mailto:seenoevil.cn@gmail.com">SeeNoEvil</a>
 */
public class NotFilter implements FileFilter {

	private FileFilter filter1;
	private FileFilter filter2;

	/**
	 * 满足filter1而不满足filter2。
	 * 
	 * @param filter1
	 *            需要满足的。
	 * @param filter2
	 *            不需要满足的。
	 */
	public NotFilter(FileFilter filter1, FileFilter filter2) {
		this.filter1 = filter1;
		this.filter2 = filter2;
	}

	public boolean accept(File pathname) {
		return (filter1.accept(pathname) && !filter2.accept(pathname));
	}
}
